import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) };
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
import { Router } from '@angular/router';
import { PagesService } from 'services/pages.service';
import { UtilService } from 'services/util.service';
import { SocketService } from 'services/socket.service';
import { fromEvent } from 'rxjs';
import axios from 'axios';
import {
  NzDropdownContextComponent,
  NzDropdownService
} from 'ng-zorro-antd';
declare var layui: any;
declare var layer: any;
declare var $: any;

@Component({
  selector: 'app-dynamic',
  templateUrl: './dynamic.component.html',
  styleUrls: ['./dynamic.component.scss']
})
export class DynamicComponent implements OnInit {

  constructor(public router: Router, private http: HttpClient, private dropdownService: NzDropdownService, public interfaceService: PagesService, public utilService: UtilService) { }

  ngOnInit() {
    this.interfaceService.loadClose();
    this.monitoring();
  }

  oInput={}
  oList={}
  oInputList=[]
  oListList=[]
  monitoring(){
    this.interfaceService.getPage('/transfer/monitoring/importantsummariesmodel').subscribe((data: any) => {
      this.oInput = data.object.input;
      this.oList = data.object.list;
      for(let i in this.oInput){
        this.oInputList.push({ename:i,zname:this.oInput[i]});
      }
      for(let i in this.oList){
        this.oListList.push({ename:i,zname:this.oList[i]});
      }
      console.log(this.oInput,'this.oInput')
      console.log(this.oList,'this.oList')
      this.summaryInfo();
    });
  }

  interval;
  info={}
  summaryInfo(){
    this.interval = setInterval(() => {
       this.interfaceService.getPage('/transfer/monitoring/importantsummaries').subscribe((data1: any) => {
         this.info = data1.object;
         console.log(this.info,'this.logText')
       });
    }, 2000);
  }

}
